﻿<%@ Page Title="" Theme="Alpha" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="EventsList.aspx.cs" Inherits="App.EventsList" %>

<%@ Register Assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.DynamicData" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Seznam akcí</h1>
   
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">     
    <ContentTemplate>
         <asp:Repeater ID="rptEvents" runat="server">
                <HeaderTemplate>
                    <div style="text-align: center; color: #7F7F7F;">
                        <asp:Panel ID="PanelFilter" runat="server" Visible="true">
                            <asp:LinkButton ID="LinkButtonActualEvents" runat="server" OnClick="LinkButtonActualEvents_Click" CommandArgument="1">Současné akce</asp:LinkButton>
                            - <asp:LinkButton ID="LinkButtonPastEvents" runat="server" OnClick="LinkButtonPastEvents_Click" CommandArgument="2">Minulé akce</asp:LinkButton>
                            - <asp:LinkButton ID="LinkButtonAllEvents" runat="server" OnClick="LinkButtonAllEvents_Click" CommandArgument="3">Všechny akce</asp:LinkButton>
                            - <asp:LinkButton ID="LinkButtonMyAction" runat="server" OnClick="LinkButtonMyAction_Click" CommandArgument="4">Mé akce</asp:LinkButton>
                        </asp:Panel>
                    </div>
                    <hr />
                </HeaderTemplate>
                
                <ItemTemplate>                    
                        
                    <div class="action <%#IsAbleToSign(Container.DataItem) ? "" : "pastAction" %>">
                        <ajaxToolkit:Gravatar ID="ImageAvatar3" runat="server" Height="50" Width="50" DefaultImageBehavior="Identicon" Email="<%#GetTeamID(Container.DataItem)%>" DefaultImage="<%#GetTeamAvatar(Container.DataItem)%>"/> 
                        <h2><font color='<%#EventActuality(Container.DataItem)%>'><%#Eval("EventName")%></font></h2>
                        <h3><asp:Label ID="LblTeamName" runat="server" Text="<%#GetTeamName(Container.DataItem)%>" ></asp:Label></h3>
                        <h4><%#Eval("DateOfHolding","{0:d. M. yyyy HH:mm}")%></h4> 
                        <div>
                
                        <asp:Label ID="Label9" runat="server" Text="Nejsem přihlášen" Visible='<%#CheckIn(Container.DataItem)%>'></asp:Label>
                        <asp:Label ID="Label10" runat="server" Text="Jsem přihlášen" Visible='<%#!CheckIn(Container.DataItem)%>'></asp:Label>
                        <b style='display: <%#IsAbleToSign(Container.DataItem) ? "inline" : "none" %>;'>|</b>                          
                            <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton1_Click" Enabled='<%#IsOccupied(Container.DataItem)%>' Visible='<%#IsAbleToSign(Container.DataItem) && CheckIn(Container.DataItem) && IsAllowed()%>' CommandArgument='<%#DataBinder.Eval(Container.DataItem,"EventID")%>' Font-Underline='false'><font color='<%#IsOccupied(Container.DataItem) ? "#880015" : "#7F7F7F"%>'><%#IsOccupied(Container.DataItem) ? "(Přihlásit se)" : "(Obsazeno)"%></font></asp:LinkButton>
                            <asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkButton2_Click" Visible='<%#IsAbleToSign(Container.DataItem) && !CheckIn(Container.DataItem)%>' Font-Underline='false' CommandArgument='<%#DataBinder.Eval(Container.DataItem,"EventID")%>'>(Odhlásit se)</asp:LinkButton>                  
                        <asp:Panel ID="Panel1" runat="server">
                                <div class="detailInfo">
                                <asp:Label ID="Label2" runat="server" Text="Akci vypsal: " CssClass="left"></asp:Label>
                                <asp:Label ID="Label53" runat="server" Text='<%#Eval("CreatedBy")%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailInfo">
                                <asp:Label ID="Label7" runat="server" Text="Cena v Kč: " CssClass="left"></asp:Label>
                                <asp:Label ID="Label54" runat="server" Text='<%#Eval("Price")%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailInfo">
                                <asp:Label ID="Label5" runat="server" Text="Místo konání: " CssClass="left"></asp:Label>
                                <asp:Label ID="Label6" runat="server" Text='<%#Eval("Address")%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailInfo">
                                <asp:Label ID="Label8" runat="server" Text="Přihlášených: " CssClass="left"></asp:Label>
                                <asp:Label ID="Label55" runat="server" Text='<%#NumberOfParticipants(Container.DataItem) + "/" + Eval("Seats")%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailInfo">
                                <asp:Label ID="Label1" runat="server" Text="Typ akce:" CssClass="left"></asp:Label>
                                <asp:Label ID="Label56" runat="server" Text='<%#ActionWithSpan(Container.DataItem)%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailBigInfo">
                                <asp:Label ID="Label3" runat="server" Text="Popis akce:" CssClass="left"></asp:Label>
                                <asp:Label ID="Label57" runat="server" Text='<%#Eval("Description")%>' CssClass="right"></asp:Label>
                                </div>
                                <div class="detailBigInfo">
                                <asp:Label ID="Label4" runat="server" Text="Přihlášení hráči: " CssClass="left"></asp:Label>
                                <span class="right">
                                <asp:Repeater ID="RepeatorUsers" runat="server" DataSource="<%#DataSource(Container.DataItem)%>">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButtonUserInfo" runat="server" CommandArgument='<%#GetUserID(Container.DataItem)%>' OnClick="LinkButtonUserInfo_Click"><%#GetUserNick(Container.DataItem)%></asp:LinkButton>
                                        (<%#GetUserNameSurname(Container.DataItem)%>)
                                        <br />
                                    </ItemTemplate>
                                </asp:Repeater>
                                </span>                   
                                </div>
                            </asp:Panel>
                            <ajaxToolkit:CollapsiblePanelExtender ID="collapsiblePanelExtender" runat="server" TargetControlID="Panel1" Collapsed="true" CollapsedText="Zobrazit detail" 
                            ExpandedText="Skrýt detail" CollapseControlID="txtLabel" ExpandControlID="txtLabel" TextLabelID="txtLabel" CollapsedSize="0" ExpandedSize="0"  />
                        <asp:Panel ID="panelHeader" runat="server" CssClass="actionControls">
                            <asp:Label ID="txtLabel" runat="server" CssClass="showDetail" />
                            <b style='display: <%#IsEventLeader(Container.DataItem)&&isNotAfterDate(Container.DataItem) ? "inline" : "none" %>;'>-</b>
                            <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButtonEditEvent_Click" Text="Editovat akci" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"EventID")%>' Visible='<%#IsEventLeader(Container.DataItem)&&isNotAfterDate(Container.DataItem)&&!IsCreatedByAdmin(Container.DataItem)%>'></asp:LinkButton>
                            <asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkButtonEditEvent_Click" Text="Editovat akci" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"EventID")%>' Visible='<%#IsCreatedByAdmin(Container.DataItem)&&IsAdmin(Container.DataItem)%>'></asp:LinkButton>
                            <b style='display: <%#IsEventLeader(Container.DataItem)&&!isNotAfterDate(Container.DataItem) ? "inline" : "none" %>;'>-</b>
                            <asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButtonAddPlayers_Click" Text="Dopsat hráče" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"EventID")%>' Visible='<%#IsEventLeader(Container.DataItem)&&!isNotAfterDate(Container.DataItem)%>'></asp:LinkButton>         
                        </asp:Panel>

                        </div>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
            <asp:Label ID="lblEmptyRepeaterText" runat="server" Text="Nejsou vypsány žádné akce" style="display: block; padding-top: 32px;" Visible="false"></asp:Label>
            </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

